<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
	<ui:composition template="template/template.xhtml">
		<ui:define  name="page-title" >#{messages.stock}</ui:define >
		<ui:define  name="center">
			<h:outputLabel value="#{messages.deposito}" for="deposito"/>
			<p:selectOneMenu id="deposito" value="#{stockController.deposito.id}" style="display: inline-block; vertical-align: middle;">  
                 <f:selectItem itemLabel="#{messages.seleccione}" itemValue="" /> 
                 <f:selectItems value="#{centroController.depositos}" var="deposito" itemValue="#{deposito.id}" itemLabel="#{deposito.nome}" />  
                 <p:ajax update="@form" event="change"/>
            </p:selectOneMenu> 
                	
          	<p:dataTable id="tabelaStock" var="stock" value="#{stockController.stockList}"  
		                 paginator="true" rows="10"  paginatorPosition="bottom"
		                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} "  
		                 rowsPerPageTemplate="5,10,15">  
		        
		    
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.id}" />  
		            </f:facet>  
		            <h:outputText value="#{stock.id}" />  
		        </p:column>  
		        
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.deposito}" />  
		            </f:facet>  
		            <h:outputText value="#{stock.deposito.nome}" />  
		        </p:column>
		        
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.material}" />  
		            </f:facet>  
		            <h:outputText value="#{stock.material.nome}" />  
		        </p:column>  
		  
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.quantidade}" />  
		            </f:facet>  
		            <h:outputText value="#{stock.quantidade}" />  
		        </p:column>  
		  
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.dataActualizacao}" />  
		            </f:facet>  
		            <h:outputText value="#{stock.dataActualizacao}" >  
		            	<f:convertDateTime pattern="#{messages.dateTimeFormat}" />
		            </h:outputText>  
		        </p:column> 
		     
		      
		    </p:dataTable>
		</ui:define >
	</ui:composition>
</html>